<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="zh">
<head>
    <title>创建课程|河海大学实践课程考勤系统</title>
    <jsp:include page="head.jsp"/>
    <script>
        function check() {
            var msg = document.getElementById("msg");
            if (document.getElementById("cname").value === "") {
                msg.innerText = "课程名称不能为空！";
                return false;
            }
            return true;
        }
    </script>
</head>
<body>
<div class="container">
    <jsp:include page="header.jsp"/>
    <div class="row">
        <div class="col-sm-offset-1 col-sm-2">
            <ul class="nav nav-pills nav-stacked">
                <li><a href="${pageContext.request.contextPath}/teacher/index">主页</a></li>
                <li><a href="${pageContext.request.contextPath}/teacher/info">个人信息</a></li>
                <li class="active"><a href="${pageContext.request.contextPath}/teacher/addcourse">添加课程</a></li>
                <li><a href="${pageContext.request.contextPath}/teacher/logout">退出登录</a></li>
            </ul>
        </div>
        <div class="col-sm-offset-1 col-sm-6">
            <h3>添加课程</h3>
            <form class="form-horizontal" action="${pageContext.request.contextPath}/teacher/addcourse" method="post"
                  onsubmit="return check()">
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="cname">课程名称</label>
                    <div class="col-sm-10">
                        <input id="cname" class="form-control" type="text" name="cname" maxlength="32">
                    </div>
                </div>
                <p id="msg" class="text-danger text-center">${requestScope.msg}</p>
                <div class="form-group">
                    <div class="col-sm-12">
                        <input class="btn btn-primary btn-block" type="submit" value="添加课程">
                    </div>
                </div>
            </form>
        </div>
    </div>
    <jsp:include page="footer.jsp"/>
</div>
</body>
</html>
